Skip to content

fix(html): stray line numbers, and two refusals that described the old editor - #879

Merged
andiwand merged 1 commit into
mainfrom
fix/refusal-messages
Sep 10, 2026
Merged

fix(html): stray line numbers, and two refusals that described the old editor#879
andiwand merged 1 commit into
mainfrom
fix/refusal-messages

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Two things found by opening the wasm example and using it.

Stray line numbers in a .txt

Deleting across several lines left one line number behind per line — 9 lines
deleted down to 7 left 8 numbers.

removeText did textNr.removeChild(textNr.lastChild). The renderer writes
the gutter formatted, so there is a whitespace text node after the last cell:
lastChild was that whitespace, and the cell survived. lastElementChild is
what reaches a cell.

The comment above getPosition already warns about exactly this for the lines
"formatted output puts a whitespace text node between them, and counting or
indexing those as lines is off by as much as a factor of two"
— and nobody
carried it across to the gutter, which is written the same way. It now says so.

A check on the page drives a three-line delete and asserts the two counts move
together, and that undo brings both back.

Two refusals describing the editor as it was

Codes are untouched, so nothing a host maps changes. The refusal table in
editing.md now also says why a range over a picture is refused:
replaceRange takes runs and whole paragraphs away, so anything else caught
between the ends would survive while the text around it went.

Reference output

resources/editing.js and resources/text.js change, so this needs a pin
advance once it lands.

…d editor

Both found by using the thing.

Deleting across several lines of a `.txt` left a line number behind per
line. `removeText` took `textNr.lastChild` away, and the renderer writes
whitespace between the number cells - so what went was a text node, not a
cell. `lastElementChild` is what reaches one, which the comment above
`getPosition` already said about the lines and nobody carried across to
the gutter. Nine lines deleted down to seven left eight numbers; a check
now drives that.

And two refusal messages still described the editor as it was before it
could span runs. Code 1 said "new line not supported by this document"
though Enter has been taken since then, and code 8 said "an edit has to
lie inside one run of text" though it now marks a range reaching over a
picture or a table - which reads as though editing across runs does not
work, when it does. The codes are untouched; only what they say changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW
@andiwand
andiwand merged commit 452fac0 into main Sep 10, 2026
36 checks passed
@andiwand
andiwand deleted the fix/refusal-messages branch September 10, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant